package com.jtframework.datasource.mysql;


import java.util.List;

public class MysqlQueryParam extends MysqlQuery {

    public boolean isOr = false;

    public MysqlQueryParam(String column) {
        super(column);
    }

    public MysqlQueryParam(String column, String value) {
        super(column, value);
    }

    public MysqlQueryParam(String sql,boolean state) {
        super(sql, state);
    }



    public MysqlQueryParam(String column, Object value, MysqlSymbol symbol) {
        super(column, value,symbol);
    }


    public void betweenAnd(String start, String end) {
        this.symbol = MysqlSymbol.BETWEEN_AND;
        this.value = start + "," + end;
    }

    public static MysqlQueryParam is(String key, String value) {
        MysqlQueryParam query = new MysqlQueryParam(key, value, MysqlSymbol.IS);
        return query;
    }

    public static MysqlQueryParam nis(String key, String value) {
        MysqlQueryParam query = new MysqlQueryParam(key, value, MysqlSymbol.NIS);
        return query;
    }

    public static MysqlQueryParam in(String key, List<String> value) {
        MysqlQueryParam query = new MysqlQueryParam(key, value, MysqlSymbol.IN);
        return query;
    }

    public static MysqlQueryParam nin(String key, List<String> value) {
        MysqlQueryParam query = new MysqlQueryParam(key, value, MysqlSymbol.NIN);
        return query;
    }

    public static MysqlQueryParam leftLike(String key, String value) {
        MysqlQueryParam query = new MysqlQueryParam(key, value, MysqlSymbol.LEFT_LIKE);
        return query;
    }

    public static MysqlQueryParam rightLike(String key, String value) {
        MysqlQueryParam query = new MysqlQueryParam(key, value, MysqlSymbol.RIGHT_LIKE);
        return query;
    }

    public static MysqlQueryParam like(String key, String value) {
        MysqlQueryParam query = new MysqlQueryParam(key, value, MysqlSymbol.LIKE);
        return query;
    }

    public static MysqlQueryParam incr(String key, String value) {
        MysqlQueryParam query = new MysqlQueryParam(key, value, MysqlSymbol.INCR);
        return query;
    }

    public static MysqlQueryParam decr(String key, String value) {
        MysqlQueryParam query = new MysqlQueryParam(key, value, MysqlSymbol.DECR);
        return query;
    }

}
